# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=py3-catalogue
pkgver=2.1.0
pkgrel=2
pkgdesc="Super lightweight function registries for your library"
url="https://github.com/explosion/catalogue"
arch="noarch"
license="MIT"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="py3-pydantic py3-pytest py3-srsly"
subpackages="$pkgname-doc $pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/explosion/catalogue/archive/v$pkgver.tar.gz"

builddir=$srcdir/catalogue-$pkgver

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl

	rm -r "$pkgdir"/usr/lib/python3*/site-packages/catalogue/_importlib_metadata/
	rm -r "$pkgdir"/usr/lib/python3*/site-packages/catalogue/tests/

	install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
}

sha512sums="
a49d1a0e0a29bdb327590f0ab73e13fa6172a4eb00716056014299d7d6cda5f882f2d89ec2c343962b9012e75167f7166379f15cd19d070bc548592ef56f9383  py3-catalogue-2.1.0.tar.gz
"
